<!--
	作者：956911785@qq.com
	时间：2018-10-18
	描述：文化课辅导班-添加
-->

<template>
	<Tcontent ref="Tcontent" :teas="params" :title="title" @addsave="addsave"></Tcontent>
</template>

<script>
	import Tcontent from "./Tcontent";
	export default {
		name:"addwhkfdb",
		props: {
    		
    	},
		data() {
			return {
				params:{
					wid:"",
					csid:"",
					nj:"",
					bj:"",
					mc:"",
					jj:"",
					fy:"",
					jlxzsj:"",
					jlscsj:"",
					wstate:"",
					xe:"",
					sksj:"",
					skdd:"",
					bmzlsm:'',
					sfjzsj:'',
					whksf:[],
					teachers:[]
				},
				title:'新增报名'
			}
		},
		components: {
			Tcontent
		},
		methods: {
			addsave:function(datas){
				const whkdata={...datas};
				var whksf=[];
				const sfdata=whkdata.whksf;
				for(var i=0;i<sfdata.length;i++){
					var sfxm=sfdata[i];
					whksf.push(sfxm);
				}
				
				
				var whk_teacher=[];
				const teadata=whkdata.teachers;
				for(var i=0;i<teadata.length;i++){
					var tea={
						tid:teadata[i].tid
					};
					whk_teacher.push(tea);
				}
				
				const params={
					nj:whkdata.nj,
					bj:whkdata.bj,
					mc:whkdata.mc,
					jj:whkdata.jj,
					fy:whkdata.fy,
					xe:whkdata.xe,
					sksj:whkdata.sksj,
					skdd:whkdata.skdd,	
					bmzlsm:whkdata.bmzlsm,	
					sfjzsj:whkdata.sfjzsj,	
					whksf:JSON.stringify(whksf),
					whk_teacher:JSON.stringify(whk_teacher),
					bmlb:'1'
				};
                this.$http.post("/host/stgl/whk/InsertWhkfdb.html",params)
				.then(result => {
					if(result){
						this.$Modal.success({
                            title: "提示",
                            content: "添加成功！"
                       });
                       this.$emit("reload");
                       this.$refs.Tcontent.closeModal();
					}else{
						this.$Modal.error({
                            title: "提示",
                            content: "添加失败，请联系管理员！"
                       });	
					}
					
				});
						
				
	        },
			openmodal(){
				this.$refs.Tcontent.modal0 = true;
			}
		},
		mounted() {

		},
		watch:{
			
		},
		computed: {
			
		}
		
	}
</script>

<style scoped="scoped">
	
</style>



